package com.bootdo.system.service.impl;

import java.util.*;
import com.bootdo.system.vo.UserVO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bootdo.common.config.DS;
import com.bootdo.common.domain.Tree;
import com.bootdo.system.dao.UserOldDao;
import com.bootdo.system.domain.DeptDO;
import com.bootdo.system.domain.UserDO;
import com.bootdo.system.service.UserOldService;
import org.springframework.web.multipart.MultipartFile;


@Service
public class UserOldServiceImpl implements UserOldService {
   
	@Autowired
    UserOldDao useroldDao;

	@DS("datasource2")
	public UserDO get(long id) {
		// TODO Auto-generated method stub
		return useroldDao.get(id);
	}

	@DS("datasource2")
	public List<UserDO> list(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return useroldDao.list(map);
	}

	@DS("datasource2")
	public List<UserDO> listUser(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return useroldDao.listUser(map);
	}
	
	
	@DS("datasource2")
	public List<UserDO> islistUser(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return useroldDao.islistUser(map);
	}
	
	@DS("datasource2")
	public List<UserDO> islistAgency(Map<String, Object> map) {
		return useroldDao.islistAgency(map);
	}

	@DS("datasource2")
	public int count(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return useroldDao.count(map);
	}
     
	@DS("datasource2")
	public int iscount(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return useroldDao.iscount(map);
	}
	
	
	@DS("datasource2")
	public int save(UserDO user) {
		// TODO Auto-generated method stub
		return useroldDao.save(user);
	}

	@DS("datasource2")
	public int update(UserDO user) {
		// TODO Auto-generated method stub
		return useroldDao.update(user);
	}

	@DS("datasource2")
	public int remove(Long userId) {
		// TODO Auto-generated method stub
		return useroldDao.remove(userId);
	}

	@DS("datasource2")
	public int batchremove(Long[] userIds) {
		int count = useroldDao.batchRemove(userIds);
		return count;
	}

	@Override
	public boolean exit(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Set<String> listRoles(Long userId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int resetPwd(UserVO userVO, UserDO UserDO) throws Exception {
		// TODO Auto-generated method stub
		return 0;
	}

	@DS("datasource2")
	public int adminResetPwd(UserVO userVO) throws Exception {
		UserDO userDO = get(userVO.getUserDO().getId());
		userDO.setPassword(userVO.getPwdNew());
		return useroldDao.update(userDO);
	
	}

	@Override
	public Tree<DeptDO> getTree() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updatePersonal(UserDO UserOld) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Map<String, Object> updatePersonalImg(MultipartFile file, String avatar_data, Long userId) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@DS("datasource2")
	public int updatePhone(UserDO UserOld) {
		// TODO Auto-generated method stub
		return useroldDao.updatePhone(UserOld);
	}

	@Override
	public boolean noexit(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return false;
	}

	@DS("datasource2")
	public int saveAdmin(UserDO user) {
		// TODO Auto-generated method stub
		return 0;
	}

	
	@DS("datasource2")
	public List<UserDO> listAllUser() {
		List<UserDO> listAllUser = useroldDao.listAllUser();
		return listAllUser;
	}

	
	


}
